import {
  getFormatterPrice
} from '@const/filter'
// 寄售补货需求订单列表页面tab状态
export const REPLENISHMENT_ORDER_STATUS = [{
  label: '待确认',
  value: 'voucherStatusNotConfirm'
},
{
  label: '待发货',
  value: 'voucherStatusNotDelivery'
},
{
  label: '部分发货',
  value: 'voucherStatusPartialShipment'
},
{
  label: '全部发货',
  value: 'voucherStatusAllShipment'
},
{
  label: '已完成',
  value: ''
},
{
  label: '已删除',
  value: ''
}
]
export const ORDER_STATUS_TEXT = {
  1: '待确认',
  2: '待发货',
  3: '部分发货',
  4: '全部发货',
  5: '已完成',
  6: '已撤销',
  7: '术后退回',
  8: '待质检',
  9: '待发货'
}
// 产品大类
export const PRODUCT_CATEGORY = {
  1: '高值',
  2: '低值',
  3: '试剂',
  4: '设备',
  5: '低值'
}
// 管理分类
export const PRODUCT_MANAGE_CATEGORY = {
  1: '一类',
  2: '二类',
  3: '三类'
}
// 注册地
export const PRODUCT_REGISTER_TYPE = {
  1: '国产',
  2: '港澳台',
  3: '进口'
}

// 查询条件
export const SEARCH_FORM = [{
  key: 'hospitalName',
  title: '医疗机构',
  type: 'input',
  attr: {
    placeholder: '请输入'
  }
},
{
  key: 'orderCode',
  title: '平台寄售订单编号',
  type: 'input',
  attr: {
    placeholder: '请输入'
  }
},
{
  key: 'deliveryOrderCode',
  title: '配送商寄售订单编号',
  type: 'input',
  attr: {
    placeholder: '请输入'
  }
},
{
  key: 'createdAt',
  title: '下单时间',
  type: 'time',
  fieldname: ['startTime', 'endTime'],
  attr: {
    placeholder: '请选择',
    type: 'daterange',
    'start-placeholder': '开始时间',
    'end-placeholder': '结束时间',
    'default-time': ['00:00:00', '23:59:59'],
    'style': {
      width: '280px'
    }
    // pickerOptions: {
    //   disabledDate: time => {
    //     return time.getTime() >= Date.now() + 8.64e7
    //   }
    // }
  }
}
]
// 寄售补货需求订单列表表头
export const ORDER_COLUMNS = [
  // {
  //   type: 'selection'
  // },
  {
    width: '200',
    prop: 'orderCode',
    label: '平台寄售订单编号',
    'show-overflow-tooltip': true
  },
  {
    width: '200',
    prop: 'deliveryOrderCode',
    label: '配送商寄售订单编号',
    'show-overflow-tooltip': true
  },
  {
    prop: 'prodTypeCount',
    minWidth: '80',
    label: '品规数',
    'show-overflow-tooltip': true
  },
  {
    prop: 'hospitalName',
    minWidth: '200',
    label: '医疗机构',
    'show-overflow-tooltip': true
  },
  {
    prop: 'orderTotalAmount',
    minWidth: '100',
    label: '寄售金额',
    formatter: row => getFormatterPrice(row.orderTotalAmount || 0)
  },
  {
    prop: 'orderStatus',
    minWidth: '100',
    label: '订单状态',
    formatter: row => ORDER_STATUS_TEXT[row.orderStatus]
  },
  {
    prop: 'createdAt',
    minWidth: '200',
    label: '提交时间'
  },
  {
    width: '200',
    prop: 'action',
    label: '操作',
    fixed: 'right'
  }
]
// 详情头部信息
export const TOP_INFO = [{
  key: 'orderCode',
  value: '平台订单编号'
},
{
  key: 'deliveryOrderCode',
  value: '配送商订单编号'
},
{
  key: 'orderStatus',
  value: '订单状态'
},
{
  key: 'createdAt',
  value: '下单时间'
},
{
  key: 'hospitalName',
  value: '医疗机构'
},
{
  key: 'prodTypeCount',
  value: '品规数'
},
{
  key: 'receiveAddress',
  value: '寄售地址'
},
{
  key: 'linkMan',
  value: '联系人'
},
{
  key: 'linkPhone',
  value: '联系电话'
},
{
  key: 'orderTotalAmount',
  value: '订单金额'
}
]
// 详情table表头
export const TABLE_COLUMNS = [{
  label: '序号',
  type: 'index',
  width: 60
}, {
  prop: 'orderItemCode',
  label: '订单明细编号',
  width: 190,
  'show-overflow-tooltip': true
}, {
  prop: 'deliveryOrderCode',
  label: '配送商产品编码',
  width: 150,
  'show-overflow-tooltip': true
}, {
  prop: 'deliveryProductName',
  label: '配送商产品名称',
  width: 150,
  'show-overflow-tooltip': true
}, {
  prop: 'specification',
  label: '规格',
  width: 150,
  'show-overflow-tooltip': true
}, {
  prop: 'productType',
  label: '型号',
  width: 150,
  'show-overflow-tooltip': true
}, {
  prop: 'manufacturer',
  label: '生产厂家',
  width: 150,
  'show-overflow-tooltip': true
}, {
  prop: 'registrationNumber',
  label: '注册证号（或备案号）',
  width: 170,
  'show-overflow-tooltip': true
}, {
  prop: 'category',
  label: '产品大类',
  width: 90,
  'show-overflow-tooltip': true,
  formatter: row => PRODUCT_CATEGORY[row.category]
}, {
  prop: 'price',
  label: '单价',
  width: 120,
  formatter: row => getFormatterPrice(row.price || 0)

}, {
  prop: 'purchaseNum',
  label: '销售数量/单位',
  width: 120,
  formatter: row => `${row.purchaseNum ? row.purchaseNum : 0} ${row.unit ? '/' + row.unit : ''}`

}, {
  prop: 'detailAmount',
  label: '小计金额',
  width: 130,
  formatter: row => getFormatterPrice(row.detailAmount || 0)
}, {
  prop: 'provinceProductCode',
  label: '省平台产品编码',
  width: 150
}, {
  prop: 'itemCode',
  label: 'M平台产品编码',
  width: 150
}, {
  prop: 'storageCondition',
  label: '储存条件',
  width: 150
}]
// 部分发货配送明细详情table头部信息
// export const TABLE_TOP_INFO = [{
//   label: '配送单号',
//   value: 'orderStatus'
// },
// {
//   label: '配送时间',
//   value: 'orderCreatedAt'
// },
// {
//   label: '配送单数量',
//   value: 'medicalInstitution'
// }
// ]
// 部分详情配送明细table列表表头
export const PART_DETAIL_COLUMNS = [
  {
    width: '40',
    prop: 'placeholder',
    fixed: 'left',
    type: 'expand'
  }, {
    prop: 'cargo',
    label: '配送明细编号',
    minWidth: 160,
    'show-overflow-tooltip': true
  }, {
    prop: 'deliveryProductCode',
    label: '配送商产品编码',
    minWidth: 160,
    'show-overflow-tooltip': true
  }, {
    prop: 'deliveryProductName',
    label: '配送商产品名称',
    minWidth: 160,
    'show-overflow-tooltip': true
  }, {
    prop: 'specification',
    label: '规格型号',
    width: 150,
    'show-overflow-tooltip': true,
    formatter: row => `${row.specification ? row.specification : ''}${row.prodType ? row.prodType : ''}`
  }, {
    prop: 'category',
    label: '产品大类',
    width: 150,
    formatter: row => PRODUCT_CATEGORY[row.category]

  }, {
    prop: 'batch',
    label: '批号',
    width: 150
  }, {
    prop: 'periodDate',
    label: '有效日期',
    width: 170
  }, {
    prop: 'sendNum',
    label: '配送单数量',
    minWidth: 160
  }, {
    prop: 'minUnit',
    label: '计量单位',
    width: 150
  }, {
    prop: 'returnNum',
    label: '质检异常数量',
    width: 150
  }, {
    prop: 'storageCondition',
    label: '储存条件',
    width: 150
  }, {
    prop: 'provinceProductCode',
    label: '省平台产品编码',
    width: 150,
    'show-overflow-tooltip': true
  }, {
    prop: 'itemCode',
    label: 'M平台产品编码',
    width: 150,
    'show-overflow-tooltip': true
  }]
// 部分详情列表中的列表
export const PART_DETAIL_COLUMNS_INSIDE = [
  {
    label: '序号',
    type: 'index',
    width: 56
  }, {
    prop: 'udi',
    label: 'UDI',
    minWidth: 100,
    'show-overflow-tooltip': true
  }, {
    prop: 'barCode',
    label: '主条码',
    minWidth: 100,
    'show-overflow-tooltip': true
  }, {
    prop: 'productBatch',
    label: '批号',
    minWidth: 100,
    'show-overflow-tooltip': true
  }, {
    prop: 'productDate',
    label: '生产日期',
    width: 100
  }, {
    prop: 'expDate',
    label: '有效期',
    width: 100
  }, {
    prop: 'erialNumber',
    label: '序列号',
    minWidth: 100,
    'show-overflow-tooltip': true
  }, {
    prop: 'num',
    label: '数量',
    width: 90
  }, {
    prop: 'entryNumd',
    label: '条码图片',
    width: 100
  }
]
// 发货头部信息
export const DELIVER_TOP_INFO = [{
  key: 'orderCode',
  value: '平台订单编号'
}, {
  key: 'deliveryOrderCode',
  value: '配送商订单编号'
},
{
  key: 'orderStatus',
  value: '订单状态'
}, {
  key: 'createdAt',
  value: '下单时间'
},
{
  key: 'hospitalName',
  value: '医疗机构'
},
{
  key: 'prodTypeCount',
  value: '品规数'
},
{
  key: 'orderDetailCount',
  value: '总数量'
},
{
  key: 'sendNumCount',
  value: '配送数量'
},
{
  key: 'awaitSendNum',
  value: '待配送数量'
},
{
  key: 'receiveAddress',
  value: '收货地址'
}, {
  key: 'linkMan',
  value: '联系人'
}, {
  key: 'linkPhone',
  value: '联系电话'
},
{
  key: 'orderTotalAmount',
  value: '订单总金额'
}
]
// 发货table列表表头
export const DELIVER_GOODS_COLUMNS = [
  {
    width: '40',
    prop: 'placeholder',
    fixed: 'left',
    type: 'expand'
  }, {
    prop: 'deliveryProductCode',
    label: '配送商产品编码',
    minWidth: 150,
    'show-overflow-tooltip': true
  }, {
    prop: 'deliveryProductName',
    label: '配送商产品名称',
    minWidth: 150,
    'show-overflow-tooltip': true
  }, {
    prop: 'productType',
    label: '规格 型号',
    width: 150,
    'show-overflow-tooltip': true,
    formatter: row => `${row.specification ? row.specification : ''}${row.prodType ? row.prodType : ''}`
  }, {
    prop: 'manufacturer',
    label: '生产厂家',
    width: 100,
    'show-overflow-tooltip': true
  }, {
    prop: 'registrationNumber',
    label: '注册证号（或备案号）',
    width: 170,
    'show-overflow-tooltip': true
  }, {
    prop: 'category',
    label: '产品大类',
    width: 100,
    'show-overflow-tooltip': true,
    formatter: row => PRODUCT_CATEGORY[row.category]

  }, {
    prop: 'purchaseNum',
    label: '订单总数量',
    width: 100
  }, {
    prop: 'sendNum',
    label: '已发货数量',
    width: 100
  }, {
    prop: 'sweepCount',
    label: '已扫码/待发货数量',
    width: 150,
    formatter: row => `${row.sweepCount ? row.sweepCount : 0}${row.awaitSendNum ? `/${row.awaitSendNum}` : '/' + 0} ${row.unit ? row.unit : ''}`
  }, {
    prop: 'storageCondition',
    label: '存储条件',
    minWidth: 100
  }, {
    prop: 'provinceProductCode',
    label: '省平台产品编码',
    width: 150,
    'show-overflow-tooltip': true
  }, {
    prop: 'itemCode',
    label: 'M平台产品编码',
    width: 150,
    'show-overflow-tooltip': true
  }, {
    prop: 'action',
    label: '操作',
    width: 100,
    fixed: 'right'
  }
]
